using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using TShooter.TfsWord.Win.WizardSupport.Design;

namespace TShooter.TfsWord.Win.WizardSupport
{
    /// <summary>
    /// Summary description for WizardHeader.
    /// </summary>
    [Designer(typeof(HeaderDesigner))]
    public partial class Header : UserControl
    {
        private Panel pnlDockPadding;
        private Label lblDescription;
        private Label lblTitle;
        private PictureBox picIcon;
        private Panel pnl3dDark;
        private Panel pnl3dBright;

        /// <summary>
        /// Constructor for Header
        /// </summary>
        public Header()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();
        }

        private void ResizeImageAndText()
        {
            //Resize image 
            picIcon.Size= picIcon.Image.Size;
            //Relocate image according to its size
            picIcon.Top = (Height - picIcon.Height)/2;
            picIcon.Left = Width - picIcon.Width - 8;
            //Fit text around picture
            lblTitle.Width = picIcon.Left - lblTitle.Left;
            lblDescription.Width = picIcon.Left - lblDescription.Left;
        }

        private void Header_SizeChanged(object sender, System.EventArgs e)
        {
            ResizeImageAndText();
        }

        /// <summary>
        /// Get/Set the title for the wizard page
        /// </summary>
        [Category("Appearance")]
        public string Title
        {
            get
            {
                return lblTitle.Text;
            }
            set
            {
                lblTitle.Text = value;
            }
        }

        /// <summary>
        /// Gets/Sets the
        /// </summary>
        [Category("Appearance")]
        public string Description
        {
            get
            {
                return lblDescription.Text;
            }
            set
            {
                lblDescription.Text = value;
            }
        }

        /// <summary>
        /// Gets/Sets the Icon
        /// </summary>
        [Category("Appearance")]
        public Image Image
        {
            get
            {
                return picIcon.Image;
            }
            set
            {
                picIcon.Image = value;
                ResizeImageAndText();
            }
        }
    }
}